Skip to content

Feature/cda 99 catalog ts extents versioned #1808

Open
rma-bryson wants to merge 4 commits into
developfrom
feature/CDA-99-Catalog-Ts-extents-versioned-improvements
Open

Feature/cda 99 catalog ts extents versioned #1808
rma-bryson wants to merge 4 commits into
developfrom
feature/CDA-99-Catalog-Ts-extents-versioned-improvements

Conversation

@rma-bryson

@rma-bryson rma-bryson commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements timeseries/versions endpoint

Related Issue

Closes #779

Validation

Unit and Integration testing

Checklist

  • AI tools used

@rma-bryson rma-bryson force-pushed the feature/CDA-99-Catalog-Ts-extents-versioned-improvements branch 5 times, most recently from 00eca9b to 541b051 Compare June 29, 2026 22:50
@rma-bryson rma-bryson changed the title Feature/cda 99 catalog ts extents versioned improvements Feature/cda 99 catalog ts extents versioned Jun 29, 2026
@rma-bryson rma-bryson marked this pull request as ready for review June 29, 2026 23:00
@rma-bryson rma-bryson force-pushed the feature/CDA-99-Catalog-Ts-extents-versioned-improvements branch from 541b051 to 2d95ffb Compare June 30, 2026 16:45
@rma-bryson rma-bryson requested a review from adamkorynta June 30, 2026 16:55
MikeNeilson
MikeNeilson previously approved these changes Jun 30, 2026
TimeSeriesDao dao = getTimeSeriesDao(dsl);

String tsId = requiredParam(ctx, NAME);
String office = ctx.queryParam(OFFICE);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

office id should be required

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to required

String cursor = ctx.queryParam(PAGE);
int pageSize = ctx.queryParamAsClass(PAGE_SIZE, Integer.class).getOrDefault(DEFAULT_PAGE_SIZE);

ZonedDateTime begin = beginStr != null ? Controllers.queryParamAsZdt(ctx, BEGIN, timezone) : null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Instant to send to the Dao, the Dao's don't need to care about time zones

@rma-bryson rma-bryson Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Instant.

@Override
public TimeSeriesVersions getTimeSeriesVersions(String cursor, int pageSize, String names, String office,
ZonedDateTime begin, ZonedDateTime end) {
Condition condition = AV_CWMS_TS_ID2.CWMS_TS_ID.eq(names);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AV_CWMS_TS_ID2 - I believe this is the view that supports aliases. That should be advertised in the OpenAPI.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment to description

@Override
public TimeSeriesVersions getTimeSeriesVersions(String cursor, int pageSize, String names, String office,
ZonedDateTime begin, ZonedDateTime end) {
Condition condition = AV_CWMS_TS_ID2.CWMS_TS_ID.eq(names);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should ignore case, the corrected case will be returned to the client

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated



@Override
public TimeSeriesVersions getTimeSeriesVersions(String cursor, int pageSize, String names, String office,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public TimeSeriesVersions getTimeSeriesVersions(String cursor, int pageSize, String names, String office,
public TimeSeriesVersions getTimeSeriesVersions(String cursor, int pageSize, String name, String office,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

+ "current location in the response stream. This is an opaque "
+ "value, and can be obtained from the 'next-page' value in the response."),
@OpenApiParam(name = PAGE_SIZE, type = Integer.class, description = "How many entries per page returned. "
+ "For JSON/XML paging, this controls page size. "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You call out XML and CSV in these docs, but the only accepted content type is json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. Copied over from the timeseries controller and missed that.

@OpenApiParam(name = END, description = "Specifies the "
+ "end of the time window for data to be included in the response. If"
+ " this field is not specified, any required time window ends at the"
+ " current time. "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the logic to contain to current time

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed part of comment containing this to current time. Don't see why a user couldn't want to get everything and not provide a time window

+ "in the response."),
@OpenApiParam(name = BEGIN, description = "Specifies the "
+ "start of the time window for data to be included in the response. "
+ "If this field is not specified, any required time window begins 24"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the 24 hour substitution

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the comment. Don't think this makes sense for versions

Record lastRecord = results.get(results.size() - 1);
Timestamp lastVersionTime = lastRecord.get(AV_TS_EXTENTS_UTC.VERSION_TIME);
if (lastVersionTime != null) {
builder.withNextPage(CwmsDTOPaginated.encodeCursor(DateUtils.toZdt(lastVersionTime).format(DateTimeFormatter.ISO_INSTANT), pageSize, total));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you transforming the version to ZonedDateTime instead of just staying at Insant?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to just use Instant

.assertThat()
.statusCode(is(HttpServletResponse.SC_OK))
.body("versions.size()", is(1))
.body("next-page", notNullValue())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend also testing the total and to make sure the extents aren't accidentally identical in both pages

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests of total and confirmation data isn't identical in both pages

@rma-bryson rma-bryson force-pushed the feature/CDA-99-Catalog-Ts-extents-versioned-improvements branch from 6091eb9 to 6895c9a Compare July 1, 2026 19:38
@rma-bryson rma-bryson force-pushed the feature/CDA-99-Catalog-Ts-extents-versioned-improvements branch from 6895c9a to b140f18 Compare July 2, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

catalog timeseries include-extents improvement - versioned time series

3 participants